<?php
defined('BME_INSERTION') or die('Error code: '.BME_INVALID_INSERT_ERROR);

if(empty($query)) $query="p1-25";

require_once(BME_ROOT."core/Dataset.php");
$Dss=new BME_Dataset();
$QDss=$Dss->getAll();
if(ereg("^p([0-9]+)-([0-9]+)$",$query,$reg)){
	$p=max((int)$reg[1],1);
	$n=(int)$reg[2];
	$nn=count($QDss);
	$pp=ceil($nn/$n);
	$headers=array("%%query_id%%","%%query_name%%","%%query_ds_contact%%","%%query_comments%%");
	foreach(array_slice($QDss,$p*$n-$n,$n) as $id){
		$Ds=new BME_Dataset();
		$Ds->load($id);
		$content[$Ds->getId()]=array($Ds->getId()." ".$Ds->getShortName(),$Ds->getName(),$Ds->getContact(),$Ds->getComments());
	}
	$_rq="query/menu/datasets";
}else echo "%%query_bad_request%%: $query<br/><br/>";

?>
